import React, {Component} from "react";
import { Link } from 'react-router-dom';
import DetailHead from '../components/DetailHead';
import Table from "../../../component/Table";

class Index extends Component{

    state = {
        columns: [
            {
                title: '#',
                width: 60,
                fixed: 'left',
                render: (text, record, index) => {
                    const {current,pageSize} = this.state.pagination;
                    return (current-1) * pageSize + (index+1)
                }
            },
            {
                title: '班级名称',
                ellipsis: true,
                render: (text) => <Link to={"/user/user_mg/class/"+text.id+'/'+text.classCode}>{text.className}</Link>,
                width: 150
            },
            {
                title: '专业',
                dataIndex: 'professional',
                width: 100
            },
            {
                title: '学生人数',
                dataIndex: 'studentNum',
                width: 100
            },
            {
                title: '带队老师',
                dataIndex: 'teacherName',
                width: 100
            },
            {
                title: '联系方式',
                dataIndex: 'telephone',
                width: 130
            },
            {
                title: '添加人',
                dataIndex: 'createName',
                width: 120
            },
            {
                title: '添加时间',
                dataIndex: 'text.createTime',
                width: 130
            }
        ],
        pagination: {
            current: 1,
            pageSize: 15
        },
        params: {
            paramsMap: {
                schoolId: this.props.match.params.id || ''
            },
            sortName: "create_time",
            sortType: "desc"
        },
        request: {
            method: 'post',
            url: '/Class/getClassPage'
        }
    };

    render() {
        return (
            <div className="table-detail">
                <DetailHead />
                <Table config={this.state}/>
            </div>
        )
    }
}

export default Index;